package fp.poczadly.client.view;

import com.google.gwt.cell.client.TextCell;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.cellview.client.AbstractHasData;
import com.google.gwt.user.cellview.client.CellList;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.HasValue;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;

import fp.poczadly.client.presenter.PrivateMessagePresenter.Display;
import fp.poczadly.shared.Utils;

public class PrivateMessageView extends Composite implements Display {

	private Label userLabel;
	
	private CellList<String> messageList;
	
	private TextBox messageTextField;
	
	private Button sendButton;
	private Button closeButton;
	
	public PrivateMessageView() {
		VerticalPanel vPanel = new VerticalPanel();
		userLabel = new Label();
		
		TextCell messageCell = new TextCell();
		messageList = new CellList<String>( messageCell );
		
		HorizontalPanel hPanel = new HorizontalPanel();
		messageTextField = new TextBox();
		sendButton = new Button( Utils.SEND );
		closeButton = new Button( Utils.CLOSE );
		
		hPanel.add( messageTextField );
		hPanel.add( sendButton );
		hPanel.add( closeButton );
		
		vPanel.add( userLabel );
		vPanel.add( messageList );
		vPanel.add( hPanel );
		
		this.initWidget( vPanel );
	}

	@Override
	public HasText userLabel() {
		return userLabel;
	}

	@Override
	public AbstractHasData<String> messageList() {
		return messageList;
	}
	
	@Override
	public HasValue<String> messageTextField() {
		return messageTextField;
	}

	@Override
	public HasClickHandlers sendButton() {
		return sendButton;
	}

	@Override
	public HasClickHandlers closeButton() {
		return closeButton;
	}
	
}
